{varType ApiGen\Index\Index $index}
{varType ApiGen\Renderer\Latte\Template\ConfigParameters $config}
{varType ApiGen\Renderer\Latte\Template\LayoutParameters $layout}

{define method, ApiGen\Info\ClassLikeInfo $classLike, ApiGen\Info\MethodInfo $method}
	{embed member, $method}
		{block cells}
			<td class="table-cell table-shrink">
				<code class="nowrap">
					{if !isInterface($classLike) && $method->abstract}abstract{elseif $method->final}final{/if}
					{include memberVisibility, $method}
					{if $method->static}static{/if}
					{if $method->byRef}&amp;{/if}
				</code>
			</td>

			<td class="table-cell">
				<code>{include methodSignature, classLike: $classLike, method: $method}</code>

				{embed memberDescription, classLike: $classLike, member: $method}
					{block details}
						{try}
							<h4>Deprecated</h4>
							<div>
								{foreach $method->tags['deprecated'] ?? [] as $tag}
									{skipIf !$tag->description}
									{longDescription($index, $classLike, $tag->description)}{sep}<br>{/sep}
								{else}
									{rollback}
								{/foreach}
							</div>
						{/try}

						{try}
							<h4>Parameters</h4>
							<table>
								{foreach $method->parameters as $parameter}
									{var string $description = $parameter->getEffectiveDescription($index, $classLike, $method)}
									{skipIf !$description}
									<tr>
										<td>{if $parameter->variadic}...{/if}<var>${$parameter->name}</var>&nbsp;&nbsp;</td>
										<td>{longDescription($index, $classLike, $description)}</td>
									</tr>
								{else}
									{rollback}
								{/foreach}
							</table>
						{/try}

						{var string $returnDescription = $method->getEffectiveReturnDescription($index, $classLike)}
						{if $returnDescription}
							<h4>Returns</h4>
							<div>{longDescription($index, $classLike, $returnDescription)}</div>
						{/if}

						{if !empty($method->tags['throws'])}
							<h4>Throws</h4>
							<table>
								{foreach $method->tags['throws'] as $tag}
									<tr>
										<td><code>{include type, type: $tag->type, scope: $classLike, short: false}</code>&nbsp;</td>
										<td>{longDescription($index, $classLike, $tag->description)}</td>
									</tr>
								{/foreach}
							</table>
						{/if}

						{* TODO: other tags (uses, internal...) *}

						{include methodRelation, title: 'Overrides', method: $method, related: $index->methodOverrides[$classLike->name->fullLower][$method->nameLower] ?? []}
						{include methodRelation, title: 'Overridden by', method: $method, related: $index->methodOverriddenBy[$classLike->name->fullLower][$method->nameLower] ?? []}
						{include methodRelation, title: 'Implements', method: $method, related: $index->methodImplements[$classLike->name->fullLower][$method->nameLower] ?? []}
						{include methodRelation, title: 'Implemented by', method: $method, related: $index->methodImplementedBy[$classLike->name->fullLower][$method->nameLower] ?? []}
					{/block}
				{/embed}
			</td>
		{/block}
	{/embed}
{/define}
